import React from 'react';
import { connect } from 'dva/index';
import { Button, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Tabs } from 'antd';
import SingleDragger from "../common/SingleDragger";
import QuoCustomerDetail from '../quotation/quotationFee/quoCustomerDetail';
import PortSelect from '../common/portSelect';
import StreetSelect from '../common/streetSelect';
import RoleSelect from '../common/roleSelect';
import { download } from '../../utils/commons';
import Constants from '../../utils/Constants';
import moment from 'moment'

const dateFormat = 'YYYY-MM-DD';
const FormItem = Form.Item;
const TabPane = Tabs.TabPane;
const CheckboxGroup = Checkbox.Group;
const RadioGroup = Radio.Group;
const R = require("ramda");

const deliveryReceiptInfo = Form.create()(class DeliveryReceiptInfo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            disabled: false,
            approval: false,
            feeInput: false
        }
    }

    handleExportBooking = () => {           //导出订舱单
        let id = R.isNil(this.props.deliveryReceipt.deliveryReceipt.id) ? "" : this.props.deliveryReceipt.deliveryReceipt.id;
        let url = apiPath.mc + "/api/file/export/booking/" + id;
        let conditions = null;
        download(url, conditions);
    }

    handleSelect = (value) => {
        if (value == "3") {
            this.setState({ approval: true })
        } else {
            this.setState({ approval: false })
        }
    };

    onChangeService = (item) => {
        if (item == "ship") {
            this.props.form.setFieldsValue({ airFreight: '', loadingPort: undefined, destinationPort: undefined });
        }
        if (item == "air") {
            this.props.form.setFieldsValue({ shipping: '', loadingPort: undefined, destinationPort: undefined });
        }
    }

    feeChange = () => {
        this.setState({ feeInput: true })
    }

    cleanItem = () => {
        //this.props.form.resetFields(['shipping', 'airFreight', 'portService', 'vasService']);
        this.props.form.setFieldsValue({ shipping: "", airFreight: "", portService: "", vasService: "", loadingPort: undefined, destinationPort: undefined })
    }

    form = {};
    flag = true;
    handleCollectForm = () => {
        this.props.form.validateFields({ force: true }, (errors, values) => {
            if (errors) {
                this.flag = false;
                return;
            } else {
                this.flag = true;
                let cstId = this.quoCustomerDetail.returnCst();
                let data = R.omit(['area'])(values);
                data.cstId = cstId;
                data.provinceCode = R.isNil(values.area) ? null : values.area[0];
                data.cityCode = R.isNil(values.area) ? null : values.area[1];
                data.districtCode = R.isNil(values.area) ? null : values.area[2];
                data.streetCode = R.isNil(values.area) ? null : values.area[3];
                data.loadingTime = R.isNil(data.loadingTime) || R.isEmpty(data.loadingTime) ? "" : data.loadingTime.format(dateFormat);
                data.quotationDeadline = R.isNil(data.quotationDeadline) || R.isEmpty(data.quotationDeadline) ? "" : data.quotationDeadline.format(dateFormat);
                data.portService = R.isNil(data.portService) || R.isEmpty(data.portService) ? "" : data.portService;
                data.vasService = R.isNil(data.vasService) || R.isEmpty(data.vasService) ? "" : data.vasService;
                data.trailerType = data.shipping || data.airFreight ? "" : data.trailerType;

                let quoCst = this.props.quotationFee.dataSource && this.props.quotationFee.dataSource.customer ? this.props.quotationFee.dataSource.customer : {};
                let cstForm = this.quoCustomerDetail.checkCstInfo();
                if (R.isNil(cstForm) || R.isEmpty(cstForm)) {
                    cstForm = this.props.company.dataSource ? this.props.company.dataSource : {};
                }
                if (this.props.quoOrderDisabled) {
                    cstForm.cstId = quoCst.id;
                }
                this.form = { ...data, ...cstForm };
            }
        })
        return this.flag;
    }

    checkDeliveryReceiptInfo = () => {
        if (this.handleCollectForm()) {
            return this.form;
        }
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        let formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 } };
        let formItemLayout2 = { labelCol: { span: 4 }, wrapperCol: { span: 19 } };
        let formItemLayout3 = { labelCol: { span: 1 }, wrapperCol: { span: 22 } };
        let serviceItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 20 } };
        let traLayout = { labelCol: { span: 12 }, wrapperCol: { span: 12 } };

        let deliveryReceiptData = this.props.deliveryReceipt.deliveryReceipt ? this.props.deliveryReceipt.deliveryReceipt : {};
        let orderDeliveryReceiptData = this.props.order.deliveryReceipt ? this.props.order.deliveryReceipt : {};
        let quickBookingData = this.props.quickBooking.dataSource ? this.props.quickBooking.dataSource : {};
        let dataSource = this.props.isOrder ? orderDeliveryReceiptData : deliveryReceiptData;

        let companyData = this.props.deliveryReceipt.company ? this.props.deliveryReceipt.company : {};
        let orderCompanyData = this.props.order.company ? this.props.order.company : {};

        let quotationData = this.props.quotationFee.dataSource && this.props.quotationFee.dataSource.quotation ? this.props.quotationFee.dataSource.quotation : {};
        let quotationTotal = this.props.quotationFee.dataSource && this.props.quotationFee.dataSource.quotationAmount ? this.props.quotationFee.dataSource.quotationAmount : {};
        let localFeeList = this.props.quotationFee.dataSource && this.props.quotationFee.dataSource.localFeeList ? this.props.quotationFee.dataSource.localFeeList : [];
        let declareFeeList = this.props.quotationFee.dataSource && this.props.quotationFee.dataSource.declareFeeList ? this.props.quotationFee.dataSource.declareFeeList : [];
        let trailerFeeList = this.props.quotationFee.dataSource && this.props.quotationFee.dataSource.trailerFeeList ? this.props.quotationFee.dataSource.trailerFeeList : [];

        let supplierList = this.props.supplier.supplierList ? this.props.supplier.supplierList : [];
        let traileList = this.props.supplier.traileList ? this.props.supplier.traileList : [];
        let declareList = this.props.supplier.declareList ? this.props.supplier.declareList : [];
        let airList = this.props.supplier.airList ? this.props.supplier.airList : [];
        let insuranceList = this.props.supplier.insuranceList ? this.props.supplier.insuranceList : [];
        let inspectionList = this.props.supplier.inspectionList ? this.props.supplier.inspectionList : [];
        let storageList = this.props.supplier.storageList ? this.props.supplier.storageList : [];
        let coList = this.props.supplier.coList ? this.props.supplier.coList : [];
        let expressList = this.props.supplier.expressList ? this.props.supplier.expressList : [];

        let berthingCompanyList = this.props.berthingCompany.berthingCompanyList ? this.props.berthingCompany.berthingCompanyList : [];
        let airCompanyList = this.props.airCompany.airCompanyList ? this.props.airCompany.airCompanyList : [];

        let area = [];
        R.isNil(dataSource.provinceCode) ? "" : area.push(dataSource.provinceCode);
        R.isNil(dataSource.cityCode) ? "" : area.push(dataSource.cityCode);
        R.isNil(dataSource.districtCode) ? "" : area.push(dataSource.districtCode);
        R.isNil(dataSource.streetCode) ? "" : area.push(dataSource.streetCode);

        let quoArea = [];
        R.isNil(quotationData.provinceCode) ? "" : quoArea.push(quotationData.provinceCode);
        R.isNil(quotationData.cityCode) ? "" : quoArea.push(quotationData.cityCode);
        R.isNil(quotationData.districtCode) ? "" : quoArea.push(quotationData.districtCode);
        R.isNil(quotationData.streetCode) ? "" : quoArea.push(quotationData.streetCode);

        let soUrl = dataSource.soUrl ? dataSource.soUrl : undefined;
        let estimatedGP = (this.props.form.getFieldValue("quoteFee") - this.props.form.getFieldValue("costFee")) ? (this.props.form.getFieldValue("quoteFee") - this.props.form.getFieldValue("costFee")) : "—";
        let estimatedGPR = ((this.props.form.getFieldValue("quoteFee") - this.props.form.getFieldValue("costFee")) / this.props.form.getFieldValue("quoteFee") * 100) ? ((this.props.form.getFieldValue("quoteFee") - this.props.form.getFieldValue("costFee")) / this.props.form.getFieldValue("quoteFee") * 100) : "—";
        estimatedGPR = Math.round(estimatedGPR * 100) / 100

        let quoGP = quotationTotal && quotationTotal.quoteTotalCNY && quotationTotal.costTotalCNY ? quotationTotal.quoteTotalCNY - quotationTotal.costTotalCNY : "-";
        let quoGRP = quotationTotal && quotationTotal.quoteTotalCNY && quotationTotal.costTotalCNY ? ((quotationTotal.quoteTotalCNY - quotationTotal.costTotalCNY) / quotationTotal.quoteTotalCNY * 100) : "-";
        quoGRP = Math.round(quoGRP * 100) / 100

        let deliveryGP = dataSource && dataSource.quoteFee && dataSource.costFee ? dataSource.quoteFee - dataSource.costFee : "-";
        let deliveryGRP = dataSource && dataSource.quoteFee && dataSource.costFee ? ((dataSource.quoteFee - dataSource.costFee) / dataSource.quoteFee * 100) : "-";
        deliveryGRP = Math.round(deliveryGRP * 100) / 100

        let gp = this.props.quoOrderDisabled ? quoGP : (this.props.businessOrder ? deliveryGP : estimatedGP)
        let grp = this.props.quoOrderDisabled ? quoGRP : (this.props.businessOrder ? deliveryGRP : estimatedGPR)

        let portItem = quotationData && quotationData.isTrailer && quotationData.isDeclare ? quotationData.isTrailer + "," + "2" : (quotationData.isTrailer ? quotationData.isTrailer : (quotationData.isDeclare ? "2" : ""));
        let vasItem = quotationData && quotationData.isInsurance ? "2" : "";

        let list = localFeeList && declareFeeList ? localFeeList.concat(declareFeeList) : (localFeeList ? localFeeList : declareFeeList);
        let quotationFeeList = list && trailerFeeList ? list.concat(trailerFeeList) : (list ? list : trailerFeeList);

        let quotationCstPrice = "";
        let quotationCompanyPrice = "";

        list.map((item) => {
            quotationCstPrice = quotationCstPrice + item.name + ": " + item.quotePrice + "\n"
            quotationCompanyPrice = quotationCompanyPrice + item.name + ":" + item.costPrice + "\n"
        })

        let portType = this.props.form.getFieldValue("airFreight") ? Constants.PORT.AIR : Constants.PORT.FRE;
        let operateInput =
            <div>
                <Col span={7}>
                    <FormItem {...formItemLayout} label='' hasFeedback>
                        {getFieldDecorator('operateUser', {
                            rules: [{
                                required: this.props.form.getFieldValue('serviceItems') && (this.props.form.getFieldValue('serviceItems').includes('6')) ? true : false, message: '请指定运营人员！',
                            }],
                            initialValue: dataSource.operateUser ? dataSource.operateUser + "" : undefined
                        })(
                            <RoleSelect role={Constants.ROLE.OPERATE_MAN} disabled={this.props.disabled} style={{ width: '100%' }} />
                            )}
                    </FormItem>
                </Col>
            </div>

        let traSelect =
            <div>
                <Col span={7}>
                    <FormItem {...traLayout} label='拖车方式' >
                        {getFieldDecorator('trailerType', {
                            rules: [{
                                required: !this.props.form.getFieldValue('shipping') && !this.props.form.getFieldValue('airFreight') &&
                                    this.props.form.getFieldValue('portService') && (this.props.form.getFieldValue('portService').includes('1')) ? true : false, message: '请选择拖车方式！',
                            }],
                            initialValue: dataSource.trailerType ? dataSource.trailerType : undefined
                        })(
                            <RadioGroup disabled={this.props.disabled}>
                                <Radio value="1">整柜</Radio>
                                <Radio value="2">吨车</Radio>
                            </RadioGroup>
                            )}
                    </FormItem>
                </Col>
            </div>

        let berCompanyItem =
            <div>
                <Col span={12}>
                    <FormItem {...formItemLayout} label="船公司" hasFeedback>
                        {getFieldDecorator('berthingId', {
                            rules: [{
                                required: this.props.accept && dataSource.shipping && this.props.form.getFieldValue("approvalresult") == "3" ? true : false, message: '请选择船公司代码'
                            }],
                            initialValue: (R.isNil(dataSource.berthingId) || R.isEmpty(dataSource.berthingId)) ? undefined : dataSource.berthingId + ""
                        })(
                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                            }>
                                {
                                    !R.isNil(berthingCompanyList) ? berthingCompanyList.map(item => {
                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{`${item.berthingCode}(${item.berthingName})`}</Select.Option>);
                                    }) : ''
                                }
                            </Select>
                            )}
                    </FormItem>
                </Col>
            </div>

        let airCompanyItem =
            <div>
                <Col span={12}>
                    <FormItem {...formItemLayout} label="航空公司" hasFeedback>
                        {getFieldDecorator('aviationId', {
                            rules: [{
                                required: this.props.accept && dataSource.airFreight && this.props.form.getFieldValue("approvalresult") == "3" ? true : false, message: '请选择航空公司代码'
                            }],
                            initialValue: (R.isNil(dataSource.aviationId) || R.isEmpty(dataSource.aviationId)) ? undefined : dataSource.aviationId + ""
                        })(
                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                {
                                    !R.isNil(airCompanyList) ? airCompanyList.map(item => {
                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{`${item.aviationCode}(${item.aviationName})`}
                                            {/*{item.aviationCode}({item.aviationName})*/}
                                        </Select.Option>);
                                    }) : ''
                                }
                            </Select>
                            )}
                    </FormItem>
                </Col>
            </div>

        return (
            <div>
                <Form>
                    <Tabs tabPosition={'top'}>
                        <TabPane tab="客户基本信息" key="1">
                            <QuoCustomerDetail wrappedComponentRef={(inst) => this.quoCustomerDetail = inst}
                                disabled={this.props.disabled}
                                isOrder={true}
                                dataSource={this.props.isOrder ? orderCompanyData : companyData}
                                cstEdit={this.props.cstEdit}
                                cstInfoDisabled={this.props.cstInfoDisabled}
                                isBooking={this.props.isBooking}
                                quoOrderDisabled={this.props.quoOrderDisabled} />
                        </TabPane>
                    </Tabs>

                    <Tabs tabPosition={'top'}>
                        <TabPane tab="服务项目信息" key="1">
                            <Row>
                                <Col span={21}>
                                    <FormItem {...formItemLayout2} label={'海运服务'}>
                                        {getFieldDecorator('shipping', {
                                            initialValue: quickBookingData.serviceItems == "1" ? "1" : quickBookingData.serviceItems == "2" ? "2" : (this.props.quoOrderDisabled ? "1" : dataSource.shipping)

                                        })(
                                            <RadioGroup style={{ width: 800 }}
                                                disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : (this.props.isBooking ? true : this.props.disabled ? true : (this.props.quoOrderDisabled ? true : false))}
                                                onChange={this.onChangeService.bind(this, "ship")}>
                                                <Radio value="1">海运整柜</Radio>
                                                <Radio value="2">海运散货</Radio>
                                                <Radio value="3">整柜双清</Radio>
                                                <Radio value="4">散货双清</Radio>
                                            </RadioGroup>
                                            )}
                                    </FormItem>
                                </Col>
                                <Col>
                                    <Button icon="delete" type="primary" size={'small'} onClick={this.cleanItem.bind(this)} style={{ display: this.props.isBooking ? 'none' : ["2", "3", "5"].includes(deliveryReceiptData.status) || orderDeliveryReceiptData.status === "3" || this.props.quoOrderDisabled || (deliveryReceiptData.status == "4" && this.props.disabled) ? 'none' : 'inline-block' }}>重置</Button>
                                </Col>
                            </Row>
                            {this.props.quoOrderDisabled ? null :
                                <Row>
                                    <Col span={21}>
                                        <FormItem {...formItemLayout2} label={'空运服务'}>
                                            {getFieldDecorator('airFreight', {
                                                initialValue: quickBookingData.serviceItems == "3" ? "1" : (this.props.quoOrderDisabled ? "1" : dataSource.airFreight)
                                                // initialValue: dataSource.airFreight
                                            })(
                                                <RadioGroup style={{ width: 800 }}
                                                    disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : (this.props.disabled ? true : false)}
                                                    onChange={this.onChangeService.bind(this, "air")}>
                                                    <Radio value="1">空运</Radio>
                                                    <Radio value="2">快递</Radio>
                                                    <Radio value="3">空派</Radio>
                                                </RadioGroup>
                                                )}
                                        </FormItem>
                                    </Col>
                                </Row>
                            }
                            <Row>
                                <Col span={21}>
                                    <FormItem {...formItemLayout2} label={'港前服务'}>
                                        {getFieldDecorator('portService', {
                                            initialValue: this.props.quoOrderDisabled ? portItem : (dataSource.portService ? dataSource.portService.split(",") : undefined)
                                        })(
                                            <CheckboxGroup style={{ width: 800 }}>
                                                <Checkbox value="1" disabled={this.props.disabled ? true : (quotationData.isTrailer ? true : false)}>拖车</Checkbox>
                                                <Checkbox value="2" disabled={this.props.disabled ? true : (quotationData.isDeclare ? true : false)}>报关</Checkbox>
                                                <Checkbox value="3" disabled={this.props.disabled}>仓库内装</Checkbox>
                                            </CheckboxGroup>
                                            )}
                                    </FormItem>
                                </Col>
                                {!this.props.form.getFieldValue('shipping') && !this.props.form.getFieldValue('airFreight') &&
                                    this.props.form.getFieldValue('portService') && (this.props.form.getFieldValue('portService').includes('1')) ?
                                    traSelect
                                    : ""}
                            </Row>
                            <Row>
                                <Col span={21}>
                                    <FormItem {...formItemLayout2} label={'增值服务'}>
                                        {getFieldDecorator('vasService', {
                                            initialValue: this.props.quoOrderDisabled ? vasItem : (dataSource.vasService ? dataSource.vasService.split(",") : undefined)
                                        })(
                                            <CheckboxGroup style={{ width: 800 }}>
                                                <Checkbox value="1" disabled={this.props.disabled ? true : false}>产地证</Checkbox>
                                                <Checkbox value="2" disabled={this.props.disabled ? true : (quotationData.isInsurance ? true : false)}>保险</Checkbox>
                                                <Checkbox value="3" disabled={this.props.disabled ? true : false}>商检</Checkbox>
                                            </CheckboxGroup>
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                        </TabPane>
                    </Tabs>

                    <Tabs tabPosition={'top'}>
                        <TabPane tab="内部交接信息" key="1">
                            <Row>
                                <Col span={15}>
                                    <FormItem {...serviceItemLayout} label={'服务项目'}>
                                        {getFieldDecorator('serviceItems', {
                                            initialValue: dataSource.serviceItems ? dataSource.serviceItems.split(",") : undefined

                                        })(
                                            <CheckboxGroup style={{ width: 800 }} disabled={this.props.disabled} >
                                                <Checkbox value="1">丑寅退税</Checkbox>
                                                <Checkbox value="2">丑寅市场采购</Checkbox>
                                                <Checkbox value="3">丑寅支付FOB费用给乐达</Checkbox>
                                                <Checkbox value="6">运营同事</Checkbox>
                                                <Checkbox value="4">丑寅支付海运费给乐达</Checkbox>
                                                <Checkbox value="5">丑寅支付所有费用给乐达</Checkbox>
                                            </CheckboxGroup>
                                            )}
                                    </FormItem>
                                </Col>
                                {this.props.form.getFieldValue('serviceItems') && (this.props.form.getFieldValue('serviceItems').includes('6')) ?
                                    operateInput
                                    : ""}
                            </Row>

                        </TabPane>
                    </Tabs>

                    <Tabs tabPosition={'top'}>
                        <TabPane tab="客户产品/运输信息" key="1">
                            <Row>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="货名" hasFeedback>
                                        {getFieldDecorator('productName', {
                                            rules: [{
                                                required: true, message: '请输入货名',
                                            }],
                                            initialValue: this.props.isBooking ? quickBookingData.product : dataSource.productName
                                        })(
                                            <Input disabled={this.props.disabled} maxLength="50" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="预计装柜时间" hasFeedback>
                                        {getFieldDecorator('loadingTime', {
                                            rules: [{
                                                required: true, message: '请选择预计装柜时间'
                                            }],
                                            initialValue: this.props.isBooking ? R.isNil(quickBookingData.loadingTime) || R.isEmpty(quickBookingData.loadingTime) ? undefined : moment(quickBookingData.loadingTime, dateFormat)
                                                : (R.isNil(dataSource.loadingTime) || R.isEmpty(dataSource.loadingTime)) ? undefined : moment(dataSource.loadingTime, dateFormat)
                                        })(
                                            <DatePicker disabled={this.props.disabled}
                                                style={{ width: '100%' }} showTime={{ format: 'YYYY-MM-DD' }}
                                                format="YYYY-MM-DD" placeholder="请选择预计装柜时间" />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="装柜联系人" hasFeedback>
                                        {getFieldDecorator('loadingContacts', {
                                            rules: [{
                                                required: false, message: '请输入装柜联系人',
                                            }],
                                            initialValue: dataSource.loadingContacts
                                        })(
                                            <Input disabled={this.props.disabled} maxLength="50" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="市场专员" hasFeedback>
                                        {getFieldDecorator('marketId', {
                                            rules: [{
                                                required: true, message: '请选择市场专员',
                                            }],
                                            initialValue: dataSource.marketId ? dataSource.marketId + "" : undefined
                                        })(
                                            <RoleSelect role={Constants.ROLE.MARKETING_SPECIALIST} disabled={this.props.disabled} style={{ width: '100%' }} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="是否有仿牌" hasFeedback>
                                        {getFieldDecorator('isReplica', {
                                            rules: [{
                                                required: true, message: '请选择是否有仿牌',
                                            }],
                                            initialValue: dataSource.isReplica
                                        })(
                                            <RadioGroup disabled={this.props.disabled}>
                                                <Radio value="1">是</Radio>
                                                <Radio value="2">否</Radio>
                                            </RadioGroup>
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="仿牌多少方" hasFeedback>
                                        {getFieldDecorator('replicaCube', {
                                            rules: [{
                                                required: this.props.form.getFieldValue('isReplica') == "1" ? true : false, message: '请输入仿牌多少方',
                                            }],
                                            initialValue: dataSource.replicaCube
                                        })(
                                            <InputNumber disabled={this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="是否有监装" hasFeedback>
                                        {getFieldDecorator('isLoadingCheck', {
                                            rules: [{
                                                required: false, message: '请选择是否有监装',
                                            }],
                                            initialValue: dataSource.isLoadingCheck
                                        })(
                                            <RadioGroup disabled={this.props.disabled}>
                                                <Radio value="1">是</Radio>
                                                <Radio value="2">否</Radio>
                                            </RadioGroup>
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="参考重量" hasFeedback>
                                        {getFieldDecorator('referenceWeight', {
                                            rules: [{
                                                required: true, message: '请输入参考重量',
                                            }],
                                            initialValue: dataSource.referenceWeight
                                        })(
                                            <InputNumber disabled={this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={24}>
                                    <FormItem {...formItemLayout2} label="装柜地址" hasFeedback>
                                        {getFieldDecorator('area', {
                                            rules: [{
                                                required: false, message: '请选择装柜地址',
                                            }],
                                            initialValue: this.props.quoOrderDisabled ? quoArea : area
                                        })(
                                            <StreetSelect style={{ width: "100%" }} disabled={this.props.disabled} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={24}>
                                    <FormItem {...formItemLayout2} label="装柜详细地址" hasFeedback>
                                        {getFieldDecorator('detailAddress', {
                                            rules: [{
                                                required: false, message: '请输入装柜详细地址',
                                            }],
                                            initialValue: dataSource.detailAddress
                                        })(
                                            <Input.TextArea disabled={this.props.disabled} maxLength="300" autosize={true} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={24}>
                                    <FormItem {...formItemLayout2} label="备注" hasFeedback>
                                        {getFieldDecorator('memo', {
                                            rules: [{
                                                required: false, message: '请输入备注',
                                            }],
                                            initialValue: dataSource.memo
                                        })(
                                            <Input.TextArea disabled={this.props.disabled} maxLength="200" autosize={true} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                        </TabPane>
                    </Tabs>

                    <Tabs tabPosition={'top'}>
                        <TabPane tab="协议报价与市场底价" key="1">
                            <Row>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="起运港" hasFeedback>
                                        {getFieldDecorator('loadingPort', {
                                            rules: [{
                                                required: true, message: '请选择起运港',
                                            }],
                                            initialValue: this.props.isBooking ? (quickBookingData.loading ? quickBookingData.loading + "" : undefined) :
                                                (this.props.quoOrderDisabled ? (quotationData.loadingPort ? quotationData.loadingPort + "" : undefined) : (dataSource.loadingPort ? dataSource.loadingPort + "" : undefined))
                                        })(
                                            <PortSelect portType={portType}
                                                disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="目的港" hasFeedback>
                                        {getFieldDecorator('destinationPort', {
                                            rules: [{
                                                required: true, message: '请选择目的港',
                                            }],
                                            initialValue: this.props.isBooking ? (quickBookingData.destination ? quickBookingData.destination + "" : undefined) :
                                                (this.props.quoOrderDisabled ? (quotationData.destinationPort ? quotationData.destinationPort + "" : undefined) : (dataSource.destinationPort ? dataSource.destinationPort + "" : undefined))
                                        })(
                                            <PortSelect portType={portType}
                                                disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>

                            <Row>
                                <Col span={2} style={{ marginLeft: 88 }}>
                                    <span><font size="2">柜型/柜量 :</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('size20gp', {
                                            initialValue: this.props.isBooking ? quickBookingData.size20gp : (this.props.quoOrderDisabled ? quotationData.size20gp : dataSource.size20gp)
                                        })(
                                            <InputNumber disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} min={0} maxLength="4" style={{ width: '100%' }} placeholder="数量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">*20GP</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('weight20gp', {
                                            initialValue: this.props.isBooking ? quickBookingData.weight20gp : (this.props.quoOrderDisabled ? quotationData.weight20gp : dataSource.weight20gp)
                                        })(
                                            <InputNumber disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} placeholder="重量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">KGS</font></span>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={3} style={{ marginLeft: 50 }}>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('size40gp', {
                                            initialValue: this.props.isBooking ? quickBookingData.size40gp : (this.props.quoOrderDisabled ? quotationData.size40gp : dataSource.size40gp)
                                        })(
                                            <InputNumber disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} min={0} maxLength="4" style={{ width: '100%' }} placeholder="数量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">*40GP</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('weight40gp', {
                                            initialValue: this.props.isBooking ? quickBookingData.weight40gp : (this.props.quoOrderDisabled ? quotationData.weight40gp : dataSource.weight40gp)
                                        })(
                                            <InputNumber disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} placeholder="重量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">KGS</font></span>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={3} style={{ marginLeft: 50 }}>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('size40hq', {
                                            initialValue: this.props.isBooking ? quickBookingData.size40hq : (this.props.quoOrderDisabled ? quotationData.size40hq : dataSource.size40hq)
                                        })(
                                            <InputNumber disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} min={0} maxLength="4" style={{ width: '100%' }} placeholder="数量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">*40HQ</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('weight40hq', {
                                            initialValue: this.props.isBooking ? quickBookingData.weight40hq : (this.props.quoOrderDisabled ? quotationData.weight40hq : dataSource.weight40hq)
                                        })(
                                            <InputNumber disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} placeholder="重量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">KGS</font></span>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={2} style={{ marginLeft: 88 }}>
                                    <span><font size="2">重量/体积 :</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('totalNum', {
                                            initialValue: dataSource.totalNum
                                        })(
                                            <InputNumber disabled={this.props.disabled} min={0} maxLength="4" style={{ width: '100%' }} />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">PKG</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('volume', {
                                            rules: [{
                                                required: ["2", "4"].includes(this.props.form.getFieldValue('shipping')) || ["1", "3"].includes(this.props.form.getFieldValue('airFreight')) ? true : false, message: '请输入体积',
                                            }],
                                            initialValue: this.props.isBooking ? quickBookingData.volume : dataSource.volume
                                        })(
                                            <InputNumber disabled={this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} placeholder="体积" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">CBM</font></span>
                                </Col>
                                <Col span={4}>
                                    <FormItem {...formItemLayout3}>
                                        {getFieldDecorator('volumeWeight', {
                                            rules: [{
                                                required: ["2", "4"].includes(this.props.form.getFieldValue('shipping')) || ["1", "3"].includes(this.props.form.getFieldValue('airFreight')) ? true : false, message: '请输入重量',
                                            }],
                                            initialValue: this.props.isBooking ? quickBookingData.weight : dataSource.volumeWeight
                                        })(
                                            <InputNumber disabled={this.props.disabled} min={0} maxLength="18" style={{ width: '100%' }} placeholder="体积重量" />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={2}>
                                    <span><font size="2">KGS</font></span>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={12}>
                                    <FormItem {...formItemLayout} label="报价有效期" hasFeedback>
                                        {getFieldDecorator('quotationDeadline', {
                                            rules: [{
                                                required: true, message: '请选择报价有效期',
                                            }],
                                            initialValue: (R.isNil(dataSource.quotationDeadline) || R.isEmpty(dataSource.quotationDeadline)) ? undefined : moment(dataSource.quotationDeadline, dateFormat)
                                        })(
                                            <DatePicker
                                                disabled={this.props.disabled}
                                                style={{ width: '100%' }}
                                                showTime={{ format: 'YYYY-MM-DD' }}
                                                format="YYYY-MM-DD"
                                                placeholder="请选择时间"
                                            />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>

                            <Row>
                                <Col span={24}>
                                    <FormItem {...formItemLayout2} label="与客户协议价格" hasFeedback>
                                        {getFieldDecorator('cstPriceDesc', {
                                            rules: [{
                                                required: true, message: '请输入客户协议价格',
                                            }],
                                            initialValue: this.props.quoOrderDisabled ? quotationCstPrice : dataSource.cstPriceDesc
                                        })(
                                            <Input.TextArea disabled={this.props.quoOrderDisabled ? true : this.props.disabled} maxLength="1000" autosize={{ minRows: 3, maxRows: 9 }} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            {this.props.quoOrderDisabled ?
                                <Row>
                                    <Col span={24}>
                                        <FormItem {...formItemLayout2} label="新增服务项目费用报价" hasFeedback>
                                            {getFieldDecorator('newCstPriceDesc', {
                                                rules: [{
                                                    required: false, message: '请输入新增服务项目费用报价',
                                                }],
                                                initialValue: ""
                                            })(
                                                <Input.TextArea disabled={false} maxLength="1000" autosize={{ minRows: 3, maxRows: 9 }} />
                                                )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                : null}
                            <Row>
                                <Col span={24}>
                                    <FormItem {...formItemLayout2} label="公司市场底价" hasFeedback>
                                        {getFieldDecorator('companyPriceDesc', {
                                            rules: [{
                                                required: true, message: '请输入公司市场底价',
                                            }],
                                            initialValue: this.props.isBooking ? quickBookingData.floor : (this.props.quoOrderDisabled ? quotationCompanyPrice : dataSource.companyPriceDesc)
                                        })(
                                            <Input.TextArea disabled={this.props.channel == Constants.DELIVERY_SOURCE.WEBBOOKING ? false : this.props.isBooking ? true : this.props.quoOrderDisabled ? true : this.props.disabled} maxLength="1000" autosize={{ minRows: 3, maxRows: 9 }} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                            {this.props.quoOrderDisabled ?
                                <Row>
                                    <Col span={24}>
                                        <FormItem {...formItemLayout2} label="新增服务项目费用底价" hasFeedback>
                                            {getFieldDecorator('newCompanyPriceDesc', {
                                                rules: [{
                                                    required: false, message: '请输入新增服务项目费用底价',
                                                }],
                                                initialValue: ""
                                            })(
                                                <Input.TextArea disabled={this.props.disabled} maxLength="1000" autosize={{ minRows: 3, maxRows: 9 }} />
                                                )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                : null}
                            {this.props.quoOrderDisabled ? <p><span style={{ color: 'red', marginLeft: 16 }}>如有新增服务项目，请重新计算并填写报价总计和底价总计</span></p> : null}
                            <Row>
                                <Col span={6}>
                                    <FormItem {...formItemLayout} label="报价总计" hasFeedback>
                                        {getFieldDecorator('quoteFee', {
                                            rules: [{
                                                required: true, message: '请输入报价总计',
                                            }],
                                            initialValue: this.props.quoOrderDisabled ? quotationTotal.quoteTotalCNY : dataSource.quoteFee
                                        })(
                                            <InputNumber disabled={this.props.disabled} maxLength="18" style={{ width: '100%' }} onChange={this.feeChange.bind(this)} />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={6}>
                                    <FormItem {...formItemLayout} label="底价总计" hasFeedback>
                                        {getFieldDecorator('costFee', {
                                            rules: [{
                                                required: true, message: '请输入底价总计',
                                            }],
                                            initialValue: this.props.quoOrderDisabled ? quotationTotal.costTotalCNY : dataSource.costFee
                                        })(
                                            <InputNumber disabled={this.props.disabled} maxLength="18" style={{ width: '100%' }} onChange={this.feeChange.bind(this)} />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={5}>
                                    <span style={{ fontSize: '14px', marginLeft: 20, lineHeight: 2.4 }}>预计毛利润: {this.state.feeInput ? estimatedGP : gp}</span>
                                </Col>
                                <Col span={7}>
                                    <span style={{ fontSize: '14px', marginLeft: 10, lineHeight: 2.4 }}>预计毛利率: {this.state.feeInput ? estimatedGPR : grp}%</span>
                                </Col>
                            </Row>
                        </TabPane>
                    </Tabs>

                    <Tabs tabPosition={'top'}>
                        <TabPane tab="操作注意事项" key="1">
                            <Row>
                                <Col span={24}>
                                    <FormItem {...formItemLayout2} label="备注" hasFeedback>
                                        {getFieldDecorator('announcements', {
                                            rules: [{
                                                required: true, message: '请输入备注',
                                            }],
                                            initialValue: dataSource.announcements
                                        })(
                                            <Input.TextArea disabled={this.props.disabled} maxLength="1000" autosize={{ minRows: 3, maxRows: 9 }} />
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                        </TabPane>
                    </Tabs>

                    {this.props.accept || (deliveryReceiptData.status == "4" && this.state.returnEdit) ?
                        <div>
                            <Tabs tabPosition={'top'}>
                                <TabPane tab="接单审批" key="1">
                                    <Row>
                                        <Col span={12}>
                                            <FormItem {...formItemLayout} label="是否接单" hasFeedback>
                                                {getFieldDecorator('approvalresult', {
                                                    rules: [{
                                                        required: true, message: '请选择审核结果！',
                                                    }],
                                                    initialValue: deliveryReceiptData.status === "2" ? null : (dataSource.status === "5" ? "3" : dataSource.status)
                                                })(
                                                    <Select disabled={deliveryReceiptData.status === "2" ? false : this.props.disabled} onChange={this.handleSelect.bind(this)}>
                                                        <Select.Option value="3">是</Select.Option>
                                                        <Select.Option value="4">否</Select.Option>
                                                    </Select>
                                                    )}
                                            </FormItem>
                                        </Col>
                                        <Col span={12}>
                                            <FormItem {...formItemLayout} label="备注" hasFeedback>
                                                {getFieldDecorator('approvalMemo', {
                                                    rules: [{
                                                        required: true, message: '请输入备注',
                                                    }],
                                                    initialValue: deliveryReceiptData.status === "2" ? null : dataSource.approvalMemo
                                                })(
                                                    <Input.TextArea disabled={deliveryReceiptData.status === "2" ? false : this.props.disabled} maxLength="200" autosize={{ minRows: 3, maxRows: 9 }} />
                                                    )}
                                            </FormItem>
                                        </Col>
                                    </Row>
                                </TabPane>
                            </Tabs>

                            {this.props.form.getFieldValue("approvalresult") == "3" || ["3", "5"].includes(deliveryReceiptData.status) ?
                                <div>
                                    <Tabs tabPosition={'top'}>
                                        <TabPane tab="供应商分配" key="1">
                                            <Row>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="海运供应商" hasFeedback>
                                                        {getFieldDecorator('shippingSupplierId', {
                                                            rules: [{
                                                                //required: this.state.approval, message: '请选择供应商代码'
                                                                required: ["1", "2", "3", "4"].includes(dataSource.shipping) ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.shippingSupplierId) || R.isEmpty(dataSource.shippingSupplierId)) ? undefined : dataSource.shippingSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && ["1", "2", "3", "4"].includes(dataSource.shipping) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(supplierList) ? supplierList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="拖车供应商" hasFeedback>
                                                        {getFieldDecorator('trailerSupplierId', {
                                                            rules: [{
                                                                required: dataSource.portService && dataSource.portService.includes("1") ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.trailerSupplierId) || R.isEmpty(dataSource.trailerSupplierId)) ? undefined : dataSource.trailerSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && (dataSource.portService && dataSource.portService.includes("1")) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(traileList) ? traileList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="报关供应商" hasFeedback>
                                                        {getFieldDecorator('declareSupplierId', {
                                                            rules: [{
                                                                required: dataSource.portService && dataSource.portService.includes("2") ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.declareSupplierId) || R.isEmpty(dataSource.declareSupplierId)) ? undefined : dataSource.declareSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && (dataSource.portService && dataSource.portService.includes("2")) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(declareList) ? declareList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="空运供应商" hasFeedback>
                                                        {getFieldDecorator('airSupplierId', {
                                                            rules: [{
                                                                required: ["1", "3"].includes(dataSource.airFreight) ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.airSupplierId) || R.isEmpty(dataSource.airSupplierId)) ? undefined : dataSource.airSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={
                                                                (deliveryReceiptData.status == "2" || this.props.marketUpdate) && ["1", "3"].includes(dataSource.airFreight) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(airList) ? airList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="快递供应商" hasFeedback>
                                                        {getFieldDecorator('expressSupplierId', {
                                                            rules: [{
                                                                required: ["2"].includes(dataSource.airFreight) ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.expressSupplierId) || R.isEmpty(dataSource.expressSupplierId)) ? undefined : dataSource.expressSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && ["2"].includes(dataSource.airFreight) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(expressList) ? expressList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="保险供应商" hasFeedback>
                                                        {getFieldDecorator('insuranceSupplierId', {
                                                            rules: [{
                                                                required: dataSource.vasService && dataSource.vasService.includes("2") ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.insuranceSupplierId) || R.isEmpty(dataSource.insuranceSupplierId)) ? undefined : dataSource.insuranceSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && (dataSource.vasService && dataSource.vasService.includes("2")) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(insuranceList) ? insuranceList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="商检供应商" hasFeedback>
                                                        {getFieldDecorator('inspectionSupplierId', {
                                                            rules: [{
                                                                required: dataSource.vasService && dataSource.vasService.includes("3") ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.inspectionSupplierId) || R.isEmpty(dataSource.inspectionSupplierId)) ? undefined : dataSource.inspectionSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && (dataSource.vasService && dataSource.vasService.includes("3")) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(inspectionList) ? inspectionList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="产地证供应商" hasFeedback>
                                                        {getFieldDecorator('coSupplierId', {
                                                            rules: [{
                                                                required: dataSource.vasService && dataSource.vasService.includes("1") ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.coSupplierId) || R.isEmpty(dataSource.coSupplierId)) ? undefined : dataSource.coSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && (dataSource.vasService && dataSource.vasService.includes("1")) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(coList) ? coList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={12}>
                                                    <FormItem {...formItemLayout} label="仓内装供应商" hasFeedback>
                                                        {getFieldDecorator('storageSupplierId', {
                                                            rules: [{
                                                                required: dataSource.portService && dataSource.portService.includes("3") ? true : false, message: '请选择供应商代码'
                                                            }],
                                                            initialValue: (R.isNil(dataSource.storageSupplierId) || R.isEmpty(dataSource.storageSupplierId)) ? undefined : dataSource.storageSupplierId + ""
                                                        })(
                                                            <Select style={{ width: '100%' }} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) && (dataSource.portService && dataSource.portService.includes("3")) ? false : this.props.disabled} showSearch placeholder="可通过输入关键字搜索" filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                                                                {
                                                                    !R.isNil(storageList) ? storageList.map(item => {
                                                                        return (<Select.Option value={item.id + ""} key={item.id + ""}>{item.supplierCode}</Select.Option>);
                                                                    }) : ''
                                                                }
                                                            </Select>
                                                            )}
                                                    </FormItem>
                                                </Col>
                                                {R.isEmpty(dataSource.shipping) ? (R.isEmpty(dataSource.airFreight) ? "" : airCompanyItem) : berCompanyItem}
                                            </Row>
                                        </TabPane>
                                    </Tabs>
                                    {dataSource.shipping || dataSource.airFreight ?
                                        <Tabs tabPosition={'top'}>
                                            <TabPane tab="订舱消息" key="1">
                                                <Row>
                                                    <Col span={12} style={{ marginBottom: 10, marginLeft: 100 }}>
                                                        <a href="#" onClick={this.handleExportBooking.bind(this)} style={{ fontSize: '14px' }}>导出订舱单</a>
                                                    </Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>
                                                        <FormItem {...formItemLayout} label="SO号" hasFeedback>
                                                            {getFieldDecorator('soNo', {
                                                                rules: [{
                                                                    required: false, message: '请输入SO号',
                                                                }],
                                                                initialValue: dataSource.soNo
                                                            })(
                                                                <Input disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) ? false : this.props.disabled} maxLength="50" />
                                                                )}
                                                        </FormItem>
                                                    </Col>
                                                    <Col span={12}>
                                                        <FormItem {...formItemLayout} label={<span>上传SO</span>} hasFeedback>
                                                            <SingleDragger url={soUrl} ref="soUrl" dataSource={dataSource} module={Constants.BOOKING_MODULES[0]} disabled={(deliveryReceiptData.status == "2" || this.props.marketUpdate) ? false : this.props.disabled} />
                                                        </FormItem>
                                                    </Col>
                                                </Row>
                                            </TabPane>
                                        </Tabs>
                                        :
                                        ""
                                    }
                                </div>
                                : ""}
                        </div>
                        : ''}
                </Form>
            </div>
        )
    }
})

function mapStateToProps(state) {
    return {
        loading: state.loading.models.deliveryReceipt, deliveryReceipt: state.deliveryReceipt, quotationFee: state.quotationFee, supplier: state.supplier,
        order: state.order, company: state.company, quickBooking: state.quickBooking, berthingCompany: state.berthingCompany, airCompany: state.airCompany
    };
}

export default connect(mapStateToProps)(deliveryReceiptInfo);